#pragma once

#include <QtWidgets/QMainWindow>

enum class httpCmd {
    H_GET,
    H_POST,
    H_PUT,
    H_DELETE,
    H_PATCH,
    H_HEAD
};

enum class PictureType {
    ptGIF,
    ptJPG,
    ptPNG,
    ptBMP,
    ptICO,
    ptSVG,
    ptTIFF,
    ptWEBP,
    ptOther
};

class QLabel;
class QLineEdit;
class QPushButton;
class QTextEdit;
class QComboBox;
class THttpClient : public QMainWindow
{
    Q_OBJECT

public:
    THttpClient(QWidget *parent = nullptr);
    ~THttpClient();

private slots:
    void onSendJsonButtonReleased();
    void onSelectImgButtonReleased();
    void onSendImgButtonReleased();

private:
    void initUI();
    void initConnect();
    int cmdToInt(httpCmd command);
    PictureType checkPictureType(const QString& fileName);
    std::string imageToString(const QString& filename);

    QLabel* m_pUrlLabel;
    QLineEdit* m_pUrlLineEdit;
    QPushButton* m_pSendButton;
    QTextEdit* m_pTextEdit;
    QComboBox* m_pMethod;
    QPushButton* m_pSelectImgButton;
    QPushButton* m_pSendImgButton;
    QString selectedImagePath;
    QString selectedImageName;
    
};
